package com.monlyu.action.broadcastError;

import com.monlyu.action.BaseAction;
import com.monlyu.bo.BroadcastErrorBo;
import com.monlyu.vo.BroadcastError;

/*******************************************************************************
 * 
 * <b>功能描述☞</b>新闻播出差错管理<br>
 * 
 * <b>开发公司☞</b>重庆唯尼科技有限公司<br>
 * <b>版权☞</b>本文件归重庆唯尼科技有限公司所有<br>
 * <b>项目名☞</b>news<br>
 * <b>文件路径☞</b>com.monlyu.action.broadcastError.EditBroadcastErrorAction.java<br>
 * <b>开发日期☞</b>2010-2-22 <br>
 * 
 * @author chendan
 * @since JDK 5
 * @version 1.0.8
 * 
 ******************************************************************************/
public class EditBroadcastErrorAction extends BaseAction {
	private BroadcastError broadcastError;
	private BroadcastErrorBo broadcastErrorBo;

	public String toEdit() {
		if (broadcastError != null && broadcastError.getId() != null) {
			broadcastError = broadcastErrorBo.getBroadcaseError(broadcastError
					.getId());
		}
		return view("editBroadcastError.jsp");
	}

	@Override
	public String execute() throws Exception {
		if (broadcastError == null) {
		} else if (broadcastError.getId() == null) {
			broadcastErrorBo.createBroadcaseError(broadcastError);
		} else {
			broadcastErrorBo.updateBroadcaseError(broadcastError);
		}
		return ajax(broadcastError.getId());
	}

	/**
	 * 删除差错信息
	 * 
	 * @return
	 * @since chendan 2010-2-22
	 */
	public String delete() {
		broadcastErrorBo.delete(broadcastError.getId());
		return ajax();
	}

	public BroadcastError getBroadcastError() {
		return broadcastError;
	}

	public void setBroadcastError(BroadcastError broadcastError) {
		this.broadcastError = broadcastError;
	}

	public void setBroadcastErrorBo(BroadcastErrorBo broadcastErrorBo) {
		this.broadcastErrorBo = broadcastErrorBo;
	}

}
